import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class RankingTestClient {

	public static void main(String[] args) throws Exception {

		String json = "{\"rankings\":[{\"codigoArticulo \":1,\"posicion\":1},{\"codigoArticulo \":2,\"posicion\":7}]}";
		CloseableHttpClient httpclient = HttpClients.createDefault();
		HttpPost httpPost = new HttpPost(
				"http://10.100.8.98:8080/PortalWeb/rest/bestSeller/procesar");
		httpPost.addHeader("Content-Type", "application/json");
		httpPost.setEntity(new StringEntity(json));
		CloseableHttpResponse response = httpclient.execute(httpPost);
		System.out.println(response.getStatusLine());
		HttpEntity entity = response.getEntity();
		System.out.println(EntityUtils.toString(entity));
		EntityUtils.consume(entity);
		response.close();

	}

}
